﻿<UserControl x:Class="BingSpatialDataServiceExcelAddin.Views.DataSourceListBox"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             Height="150" Width="350">
    
    <Grid>
        <ListBox ItemsSource="{Binding}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Height="80" Margin="5" Width="300">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Data Source Name: "/>
                            <TextBlock Text="{Binding Name}" FontWeight="Bold"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Row="1">
                            <TextBlock Text="Entity Type Name: "/>
                            <TextBlock Text="{Binding EntityType}" FontWeight="Bold"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Row="2">
                            <TextBlock Text="Query URL:"/>
                            <TextBox Text="{Binding QueryURL}" IsReadOnly="True" Width="220" Margin="10,0,10,0"/>
                        </StackPanel>

                        <Grid Grid.Row="3" Margin="0,5,0,0">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Public: " Margin="0,5,0,0"/>
                                <CheckBox IsChecked="{Binding IsPublic}" Click="IsPublic_Checked" Tag="{Binding}" Margin="0,5,0,0"/>
                            </StackPanel>
                            <Button Content="Download" Width="80" Height="25" Click="DownloadBtn_Click" Tag="{Binding}" Margin="10,0"/>

                            <Button Content="Delete" Margin="207,0,10,0" Width="80" Height="25" Click="DeleteBtn_Click" Tag="{Binding}"/>
                        </Grid>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
